# include <bits/stdc++.h>
# define N 20000005
# define mod 998244353
using namespace std;
long long qpow(long long x,int y)
{
    long long ans=1;
    while(y)
    {
        if(y&1)
            ans=ans*x%mod;
        x=x*x%mod;
        y>>=1;
    }
    return ans;
}
int n,m;
long long jie[N],ijie[N];
long long F[N],G[N];
int fac[N];
int main()
{
    freopen("drama.in","r",stdin);
    freopen("drama.out","w",stdout);
    cin>>n>>m;
    n=min(n,m);
    swap(n,m);
    jie[0]=1;
    for(int i=1;i<=n;i++)
        jie[i]=jie[i-1]*i%mod;
    ijie[n]=qpow(jie[n],mod-2);
    for(int i=n;i>=1;i--)
        ijie[i-1]=ijie[i]*i%mod;
    int k=__lg(m)+2;
    F[1]=1,F[0]=0;
    for(int i=2;i<=m;i++)
        if(!fac[i])
        {
            fac[i]=i;
            F[i]=qpow(i,n);
            for(int j=i;1ll*i*j<=m;j++)
                if(!fac[i*j])
                    fac[i*j]=i;
        }
        else
            F[i]=F[fac[i]]*F[i/fac[i]]%mod;
    for(int i=0;i<=m;i++)
        F[i]=F[i]*ijie[i]%mod,G[i]=((n-i)%2)?(mod-ijie[i]):ijie[i];
    for(int i=1;i<=m;i++)
        F[i]=(F[i-1]+F[i])%mod;
    long long res=0;
    for(int i=0;i<=m;i++)
        res=(res+F[i]*G[m-i])%mod;
    cout<<res<<endl;
    // cerr<<clock()*1.0/CLOCKS_PER_SEC<<endl;
    return 0;
}